aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/pages/raw/[hash].js
blob: d0a66a7646cec86a324c05b6c0a30aa721b472c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import React from 'react';
import resolvePaste from "../../http/useFetchPaste";
import {CodeLike} from "../../components/Common/mixins";
import styled from 'styled-components'

const RawText = styled.pre`
    ${CodeLike}
    padding: 0 1em;
`

export async function getServerSideProps(ctx) {
  const data = await resolvePaste(ctx.params.hash)

  // Pass data to the page via props
  return { props: { ...data } }
}

const Raw = ({error, data}) => {
  return <RawText>
    {data?.content || error}
  </RawText>
}

export default Raw